package com.woniuxy01;

import java.text.MessageFormat;

public class Test03 {
    public static void main(String[] args) {
//        String s1="aaa";
//        System.out.println(s1);

        String name="zs";
        int age=11;
        char gender='男';
        int score=80;

        System.out.println("name:"+name+",age:"+age+",gender:"+gender+",score:"+score);
        //format格式化字符串的方法
        //方法:功能，操作
        //参数:参与操作的数据
        //返回值：操作的结果
        String str = String.format("name:%s,age:%d,gender:%c,score:%d",name,age,gender,score);
        System.out.println(str);
        System.out.println(String.format("name:%s,age:%d,gender:%c,score:%d",name,age,gender,score));

        System.out.println(MessageFormat.format("name:{0},age:{1},gender:{2},score:{3}",name,age,gender,score));
        System.out.println(MessageFormat.format("name:{0},age:{1},gender:{2},score:{3}",name,age));
        System.out.println(MessageFormat.format("name:{0},age:{1},gender:{1},score:{1}",name,age,gender,score));
        System.out.println(
                MessageFormat.format("name:{0},age:{1},gender:{2},score:{3},age:{4}",name,age,gender,score,age));
        System.out.println(
                MessageFormat.format("name:{0},age:{1},gender:{2},score:{3},age:{1}",name,age,gender,score));
    }
}
